package com.ruoyi.datam.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.datam.service.IWcChanBService;
import com.ruoyi.datam.vo.IrrigatedAreaVO;
import com.ruoyi.datam.vo.WaterSupplyDistributionVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * gis接口
 */
@RestController
@RequestMapping("/gis")
public class GisController extends BaseController {

    @Autowired
    private IWcChanBService wcChanBService;

    /**
     * 统计各个渠道下的地块面积
     */
    @GetMapping("/landAreaByChan/{chanCd}")
    public AjaxResult getlandAreaByChan(@PathVariable String chanCd)
    {

        return AjaxResult.success(wcChanBService.getlandAreaByChan(chanCd));
    }

    /**
     * 统计渠系供配水关系和渠道灌溉水利用系数
     */
    @GetMapping("/getChanWaterByChan/{chanCd}")
    public AjaxResult getChanWaterByChan(@PathVariable String chanCd)
    {

        return AjaxResult.success(wcChanBService.getChanWaterByChan(chanCd));
    }

    // 渠道供配水关系
    @GetMapping("/waterSupplyDistribution/{chanCode}")
    public AjaxResult waterSupplyDistribution(@PathVariable("chanCode") String chanCode){
        WaterSupplyDistributionVO vo = wcChanBService.waterSupplyDistribution(chanCode);
        return AjaxResult.success(vo);
    }

    // 灌溉面积
    @GetMapping("/irrigatedArea/{chanCode}")
    public AjaxResult irrigatedArea(@PathVariable("chanCode") String chanCode){
        IrrigatedAreaVO vo = wcChanBService.irrigatedArea(chanCode);
        return AjaxResult.success(vo);
    }
}
